import Vue from 'vue'
import VueRouter, { RouteConfig } from 'vue-router'

const req = require.context('@/router/modules',false, /\.ts$/)
const requireAll = (requireContext:any) => {
    return requireContext.keys().map(requireContext);
}
var arr:Array<any> = []
requireAll(req).forEach((item:any) => {
  arr = [...arr,...item.default]
})

Vue.use(VueRouter)
const routes: Array<RouteConfig> = [
  ...arr
]

const router = new VueRouter({
  routes
})

export default router
